package com.itheima.test;

public class Test2 {
    public static void main(String[] args) {
        //判断101-200之间有多少个素数，并输出所有素数
        int count = 0;
        for (int i = 101; i <= 200; i++) {
            if(isPrime(i)){
                count++;
                System.out.print(i + " ");
            }
        }
        System.out.println();
        System.out.println("101-200之间有" + count + "个素数");
    }
    public static boolean isPrime(int n){
        for (int i = 2; i < n; i++) {
            if(n % i == 0){
                return false;
            }
        }
        return true;
    }
}
